﻿/*
 * Ejemplo de Statemanager XNA 4.0
 * 
 * 100% XNA & XNACommunity- 2010
 * http://100xna.wordpress.com/
 * http://xnacommunity.codeplex.com
 * 
 */

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace StateExample
{
    /// <summary>
    /// Clase abstracta. Todos los estados deben derivar de esta clase
    /// </summary>
    public abstract class State
    {

        StateManager manager;           //Manager de estados
        ContentManager content;         //ContentManager para los recursos del juego
        GraphicsDeviceManager graphics; //Graphics
        Game game;                      //Juego 

        public Game Game
        {
            get { return game; }
        }

        public StateManager Manager
        {
            get { return manager; }
        }

        public ContentManager Content
        {
            get { return content; }
        }

        public GraphicsDevice GraphicsDevice
        {
            get { return graphics.GraphicsDevice; }
        }

        public GraphicsDeviceManager GraphicsManager
        {
            get { return graphics; }
        }
        

               
        public State(Game game)
        {
            this.game = game;
            manager = game.Services.GetService(typeof(StateManager)) as StateManager;
            content = game.Services.GetService(typeof(ContentManager)) as ContentManager;
            graphics = game.Services.GetService(typeof(IGraphicsDeviceService)) as GraphicsDeviceManager;
        }

        /// <summary>
        /// Actualiza la logica del estado actual del juego
        /// </summary>
        /// <param name="gameTime"></param>
        public abstract void Update(GameTime gameTime);

        /// <summary>
        /// Pinta el estado en el juego
        /// </summary>
        /// <param name="gameTime"></param>
        public abstract void Draw(GameTime gameTime);
        
    }
}
